local skel = fk.CreateSkill {
  name = "emo__shenchong",
  tags = {Skill.Compulsory},
}

skel:addEffect(fk.RoundStart, {
  anim_type = "drawcard",
  mute = true,
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skel.name) then
      return player.room:getBanner("RoundCount") == 1
    end
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    player:broadcastSkillInvoke(skel.name, 1)
    room:notifySkillInvoked(player, skel.name, "drawcard")
    local get = {room:printCard("wardog", Card.Club, 2).id, room:printCard("eagle", Card.Diamond, 2).id}
    for _, id in ipairs(get) do
      room:setCardMark(Fk:getCardById(id), "@@emo__shenchong", 1)
    end
    room:setPlayerMark(player, skel.name, get)
    room:obtainCard(player, get, true, fk.ReasonJustMove, player, skel.name)
  end,
})

skel:addEffect(fk.RoundStart, {
  anim_type = "drawcard",
  mute = true,
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skel.name) then
      return table.find(player:getTableMark(skel.name), function (id)
        local place = player.room:getCardArea(id)
        return (place == Card.DiscardPile or place == Card.DrawPile or place == Card.PlayerHand)
        and player.room:getCardOwner(id) ~= player
      end)
    end
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    player:broadcastSkillInvoke(skel.name, 1)
    room:notifySkillInvoked(player, skel.name, "drawcard")
    local get = table.filter(player:getTableMark(skel.name), function(id)
      local place = player.room:getCardArea(id)
      return (place == Card.DiscardPile or place == Card.DrawPile or place == Card.PlayerHand)
      and player.room:getCardOwner(id) ~= player
    end)
    room:obtainCard(player, get, true, fk.ReasonPrey, player, skel.name)
  end,
})

-- 使用犬和鹰的特殊语音
skel:addEffect(fk.CardUsing, {
  can_refresh = function (self, event, target, player, data)
    return target == player and player:hasShownSkill(skel.name) and (data.card.name == "wardog" or data.card.name == "eagle")
  end,
  on_refresh = function (self, event, target, player, data)
    player:broadcastSkillInvoke(skel.name, data.card.name == "wardog" and 2 or 3)
  end,
})

Fk:loadTranslationTable{
  ["emo__shenchong"] = "神宠",
  [":emo__shenchong"] = "锁定技，首轮开始时，你获得一张♣2【犬】和一张<font color='red'>♦2</font>【鹰】。每个回合结束时，你从牌堆、弃牌堆或其他角色手牌中获得这些牌。",
  ["@@emo__shenchong"] = "神宠",

  ["$emo__shenchong1"] = "啸天安在，听吾神旨",
  ["$emo__shenchong2"] = "好狗儿，上",
  ["$emo__shenchong3"] = "去，试他真假",
}


return skel
